﻿using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;

public class GameController : MonoBehaviour 
{
    public CharacterMotor motor;

    public static GameController instance;

    private void Awake()
    {
        instance = this;
    }

	private IEnumerator Start () 
    {
        List<MouseLook> mouseLooks = new List<MouseLook>(
            Camera.main.GetComponentsInChildren<MouseLook>()
        );

        motor.canControl = false;
        mouseLooks.ForEach(
            ml => ml.enabled = false
        );

        yield return StartCoroutine(Wait(3));

        motor.canControl = true;
        mouseLooks.ForEach(
            delegate (MouseLook ml)
            {
                ml.enabled = true;
            }
        );

        GC.Collect();
	}
	
    IEnumerator Wait(float delay)
    {
        yield return new WaitForSeconds(delay);
    }
}
